package com.nj.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nj.api.entity.Account;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

public interface AccountMapper extends BaseMapper<Account> {
    @Update("update u_finance_account set available_money=available_money-#{bidMoney} where uid=#{uid} and " +
            "available_money>#{bidMoney} ")
    int deduct(@Param("uid") Integer uid, @Param("bidMoney") BigDecimal bidMoney);
    @Update("update u_finance_account set available_money=available_money+#{incr} where uid=#{uid}")
    void increaseMoney(@Param("uid") Integer uid,@Param("incr") BigDecimal incr);
    @Update("update u_finance_account set available_money=available_money+#{money} where uid=#{uid}")
    void updateA(@Param("uid") Integer uid,@Param("money") BigDecimal money);
}
